<template>
  <a-card class="info" title="入职申请单">
      <!-- <template slot="extra">
      <template v-if="model.bpmStatus==='1'">
        <a-button
                class="ruleButton"
                :ghost="true"
                type="primary"
                icon="edit"
                @click="handleEdit(model)"
                :disabled="isDisabledAuth('erpHrInductionBill:edit')"
        />
        <a-divider type="vertical"/>
        <a-button type="primary" size="small" @click="startProcess(model)" :disabled="isDisabledAuth('erpHrInductionBill:startProcess')">发起流程</a-button>
      </template>
      <template v-if="showBtn(model.bpmStatus)&& doCount > 0">
        <span v-if="model.taskUrge">
          <a-icon title="催办提醒" theme="twoTone" twoToneColor="#eb2f96"
                  @click="taskNotifyMe(flowCode,model.id)" type="notification"/>
          <a-divider type="vertical"/>
        </span>

        <a-button type="primary" size="small" @click="handleProcess(model)">办理</a-button>
        <a-divider type="vertical"/>
      </template>
      <template v-if="myCount > 0 && showBtn(model.bpmStatus)">
        <a-button type="primary" size="small" @click="taskNotify(flowCode,model.id)">催办</a-button>
        <a-divider type="vertical"/>
        <a-popconfirm title="确定要作废吗?" @confirm="() => invalidProcess(model)">
          <a-button type="primary" size="small" :disabled="isDisabledAuth('erpHrInductionBill:invalidProcess')">
            作废流程
          </a-button>
        </a-popconfirm>
        <a-divider type="vertical"/>
      </template>
      <template v-if="model.bpmStatus !== '1'">
        <a-button type="primary" size="small" @click="handleTrack(model)" :disabled="isDisabledAuth('erpHrInductionBill:viewTrack')">审批进度</a-button>
      </template>
      </template> -->
     <!-- <biz-his-task-module ref="bizHisTask" :formData="formData">  -->
     <a-row type="flex"  justify="center" v-if="model">
       <a-col :span="24">
          <erp-hr-induction-bill-form ref="realForm" :disabled="true" normal></erp-hr-induction-bill-form>
       </a-col>
       <a-col :span="24">
       <a-collapse v-model="activeKey"  v-if="model.offerStatus=='1'">
          <a-collapse-panel key="3" header="Offer信息">
                <a-form :form="model" style="padding-top: 20px">
                  <a-form-item
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    label="收件邮箱">
                    <a-input  placeholder="请输入收件邮箱" v-model="model.email" disabled></a-input>
                  </a-form-item>
                  <a-form-item
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    label="标题">
                    <a-textarea placeholder="请输入标题" :row="1" v-model="model.emailTitle" disabled/>
                  </a-form-item>
                  <a-form-item
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    label="内容">
                    <j-editor
                      v-model="model.content"
                      ref="editor" style="width: 100%;" disabled>
                    </j-editor>
                  </a-form-item>
                </a-form>
          </a-collapse-panel>
        </a-collapse>
        </a-col>
     </a-row>
     <div v-else>暂无入职信息</div>
      <!-- </biz-his-task-module> -->
     <!-- <erp-hr-induction-bill-modal ref="modalForm" @ok="modalFormOk"></erp-hr-induction-bill-modal>
     <bpm-biz-task-deal-modal ref="taskDealModal" :path="path" :formData="formData"
                             @ok="handleOk"></bpm-biz-task-deal-modal>
     <bpm-process-track-modal ref="bpmProcessTrackModal"></bpm-process-track-modal>
     <biz-task-notify-modal ref="taskNotifyModal"></biz-task-notify-modal>
     <biz-task-notify-me-modal ref="taskNotifyMeModal"></biz-task-notify-me-modal> -->
  </a-card>
</template>

<script>

  import { getAction,postAction } from '@/api/manage'
  import {JeecgBpmListMixin} from '@/mixins/JeecgBpmListMixin'
  // import BizHisTaskModule from "@/views/modules/bpmbiz/common/BizHisTaskModule.vue";
  // import BpmBizTaskDealModal from "@/views/modules/bpmbiz/common/BpmBizTaskDealModal.vue";
  // import BpmProcessTrackModal from "@/views/modules/bpmbiz/common/BpmProcessTrackModal.vue";
  // import BizTaskNotifyModal from "@/views/modules/bpmbiz/common/BizTaskNotifyModal.vue";
  // import BizTaskNotifyMeModal from "@/views/modules/bpmbiz/common/BizTaskNotifyMeModal.vue";
  import ErpHrInductionBillForm from '@views/erp/hr/induction/modules/ErpHrInductionBillForm'
  // import ErpHrInductionBillModal from '@views/erp/hr/induction/modules/ErpHrInductionBillModal'
  import {DisabledAuthFilterMixin} from '@/mixins/DisabledAuthFilterMixin'

  export default {
    name: 'ErpHrInductionBillDetail',
    mixins: [JeecgBpmListMixin, DisabledAuthFilterMixin],
    components: {
     ErpHrInductionBillForm,
    //  ErpHrInductionBillModal,
    //  BizHisTaskModule,
    //  BpmBizTaskDealModal,
    //  BpmProcessTrackModal,
    //  BizTaskNotifyModal,
    //  BizTaskNotifyMeModal,
    },
    data () {
      return {
        activeKey:['3'],
         model: {},
         labelCol: {},
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 24 },
        },
        id: '',
        url: {
          queryById: "/api/erp/hr/induction/erpHrInductionBill/queryInductionByApplyId",
          delete: "/api/erp/hr/induction/erpHrInductionBill/delete",
          bizCount: "/api/erp/hr/induction/erpHrInductionBill/bizCount",
        },
        confirmLoading: false,
        iconStyle:{"font-size":"20px"},
        //代码生成后需手动设置流程编码
        flowCode: 'onl_erp_hr_induction_bill',
        formUrl: "erp/hr/induction/modules/ErpHrInductionBillForm",
        formUrlMobile: "",
        disableMixinCreated: true
      }
    },
    props: {
      applyId: String
    },
    watch: {
      applyId: {
        handler: function(val){
          if(!val){
            this.model = null
          } else {
            this.getData(val)
          }
        },
        immediate: true
      },
      // BUG4233 查看多人员工档案信息，信息数据被覆盖
      $route(to, from) {
        this.getData(to.query.applyId)
      },
    },
    methods: {
      getData(id) {
        getAction(this.url.queryById, { applyId: id }).then((res) => {
          if (res.success) {
            this.model = res.result
            this.$refs.realForm.model = res.result;
            // this.model=model;
            //查询催办
            // let params1 = {flowCode: this.flowCode, dataId: id};//查询条件
            // getAction(this.url.checkNotify, params1).then((res2) => {
            //   if (res2.result) {
            //     this.model.taskUrge = true;
            //   }
            // })
            // //查询流程
            // let params = {flowCode: this.flowCode, dataId: this.model.id};//查询条件
            // this.viewTrack(params);
          }
        })
        this.bizCountById(id);
      },
    }
  }
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';

.info {
  /deep/ .ant-card-head-title{
    flex: none;
    margin-right: 20px;
  }
  /deep/ .ant-card-extra{
    flex: 1;
    float: left;
  }
}
</style>
